@extends('admin.common.base-master')

@section('html-head')
    <link href="{{url('css/jquery.form.css')}}" type="text/css" rel="stylesheet" />
    <script src="{{url('/js/lib/jquery.form.js')}}"></script>
    <style>
        .btn_add_classify{
            background: #31bcd3;margin-left:10px;height: 5px;width: 50px;color: white;text-align: center;padding:5px;border-radius:7px;box-shadow: 3px 2px 9px #888888;
        }
    </style>
@endsection

@section('html-body')
    <div id="content">
        <div id="cur-position">
            <span class="tit">当前位置：</span>
            <a href="{{route('Admin.Home.resumeList')}}">简历列表</a>
        </div>

        <!--二级目录-->
        @include('admin.common.resume-header')

        <div class="table-box">
            <table class="table">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>头像</th>
                    <th>真实姓名</th>
                    <th>性别</th>
                    <th>年龄</th>
                    <th>地址</th>
                    <th>联系号码</th>
                    <th>期望薪资</th>
                    <th>职位</th>
                    <th>创建时间</th>
                    <th>查看简历详情</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @if(count($resumes)>0)
                    @foreach($resumes as $resume)
                    <tr id="resume_{{$resume->id}}">
                        <td>{{$resume->id}}</td>
                                <td class="account-td" style="width: 5%;">
                                    <span class="photo" style="border-radius: 100%;display:initial">
                                        @if($resume->photo_id !== 0)
                                            <a href="javascript:void(0);" class="openimg" data-key="{{$resume->photo_id}}"><img src="{{$resume->photo_url}}" alt="{{$resume->photo_url}}"></a>
                                        @else
                                            img src="{{url('images/default-img.png')}}" alt="">
                                        @endif
                                    </span>
                                </td>
                                <td>{{$resume->realname}}</td>
                                <td>
                                    @if($resume->sex == 0)
                                        保密
                                    @elseif($resume->sex == 1)
                                        男
                                    @elseif($resume->sex == 2)
                                        女
                                    @endif
                                </td>

                        <td>{{$resume->age}}</td>
                        <td>{{$resume->province}}{{$resume->city}}{{$resume->area}}{{$resume->address_detail}}</td>
                        <td>{{$resume->phone   }}</td>
                        <td>{{$resume->expected_salary_type}}{{$resume->expected_salary}}</td>
                        <td>{{$resume->job_type_id}}</td>
                        <td>{{$resume->created_at}}</td>

                        <td><a href="{{route("Admin.Home.resumeUserDetail")}}?resume_id={{$resume->id}}" target="_blank">查看详情</a> </td>
                        <td><a href="javascript:void(0);" class="del" data-id="{{$resume->id}}" >删除</a></td>
                    </tr>
                @endforeach
                    @endif

                </tbody>
            </table>
            <?php echo $resumes->render();?>
        </div>
    </div>
    <script>
        $(document).on("click",".del",function(){
            var id = $(this).attr("data-id");

            noty({
                text: '你确定要删除吗?',
                buttons: [
                    {addClass: 'btn btn-primary', text: '确定', onClick: function($noty) {
                            $noty.close();
                            $.ajax({
                                url:'{{route('Api.Admin.sys.delResume')}}',
                                type:'post',
                                dataType:'json',
                                data:{id:id},
                                success:function(obj){
                                    if(obj.level == "success"){
                                        $("#resume_"+id).hide('slow');
                                    }else{
                                        noty({type:obj.level,text:obj.message,timeout:600});
                                    }
                                },
                                error:function(obj){
                                    console.log(obj);
                                }

                            });
                        }
                    },
                    {addClass: 'btn btn-danger', text: '取消', onClick: function($noty) {
                            $noty.close();
                        }
                    }
                ]
            });

        });

    </script>
@endsection
